﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.CSS.SAC.Selectors
{
    #region Using Statements

    using System.Collections.Generic;

    #endregion

    public class SelectorList
    {
        #region Attributes

        private List<Selector> Selectors { get; set; }

        #endregion

        #region Constructors

        internal SelectorList()
        {
            Selectors = new List<Selector>();
        }

        internal SelectorList(IEnumerable<Selector> _selectors)
        {
            Selectors = new List<Selector>(_selectors);
        }

        #endregion

        #region Methods

        /// <summary>
        /// Adds a selector to the list.
        /// </summary>
        /// <param name="s"></param>
        internal void Add(Selector s)
        {
            Selectors.Add(s);
        }

        /// <summary>
        /// Returns the number of items in the list.
        /// </summary>
        /// <returns></returns>
        public int getLength()
        {
            return Selectors.Count;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Selector item(int index)
        {
            return Selectors[index];
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Selector this[int index]
        {
            get
            {
                return Selectors[index];
            }
        }

        #endregion
    }
}
